<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>设置VIP通道</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../../css/font.css">
    <link rel="stylesheet" href="../../css/xadmin.css">
    <script type="text/javascript" src="../../lib/layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/jquery.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script type="text/javascript" src="../../js/commonutil.js"></script>
    <script src="./function.js" charset="utf-8"></script>
</head>
<body>
<div class="edit-form-class" style="padding-top: 20px;">
    <form class="layui-form" id="setVipForm" onsubmit="return false">
        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color:red">*</span> VIP通道</label>
            <div class="layui-input-block" style="width: 350px">
                <select name="vipStatus" lay-filter="vipStatus" id="vipStatus" lay-verify="required|vipStatusVerify">
                    <option value="1">VIP通道一</option>
                    <option value="2">VIP通道二</option>
                    <option value="3">VIP通道三</option>
                    <option value="4">VIP通道四</option>
                    <option value="5">VIP通道五</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item" style="padding-top: 120px;padding-left: 60px;">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" autocomplete="off" lay-filter="submitBtn" id="submitBtn">保存
                </button>
                <button type="reset" id="closeNow" class="layui-btn layui-btn-primary">取消</button>
            </div>
        </div>
    </form>
</div>
</body>

<script>

    var index;
    jQuery(function () {
        layui.use(['laypage', 'jquery', 'layer', 'table', 'form', 'util', 'upload', 'layedit'], function () {
            let form = layui.form;
            //select监听
            selectListener(form);
            form.render();
        });
    });
    $("#closeNow").click(function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    })
    //提交
    $('#submitBtn').click(function () {
        var id = GetUrlParam("id");
        var formData = serializeObject($("#setVipForm"));
        var status = formData.vipStatus;
        var url = serverPre + "/manager/scs/v2/management/template/vip/"+id+"/"+status;
        $.ajax({
            type: "GET",
            headers: {"token": getCookie("token")},
            url: url,
            success: function(res){
                if (res.code === 0) {
                    layui.use('layer',function(){
                        let layer = layui.layer;
                        layer.msg("保存成功!",{
                            icon:1,
                            time:2000,
                            end: function () {
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index);
                                parent.location.reload();
                            }
                        });
                    });
                }else {
                    errorMsg(res.msg)
                }
            }
        });
    });

</script>
</html>
